<?php
namespace Core;
use Core\Event\Dispatch;
use Core\Event\ModelsManager;
use Core\Event\Application AS EventApplication;
use Core\Event\View;
use Phalcon\Di\Injectable;
class Event extends Injectable
{

    //Manager constructor.
    public function __construct() {
        $eventsManager = $this->eventsManager;
        $this->app->setEventsManager($eventsManager);
        $this->dispatcher->setEventsManager($eventsManager);
        $this->modelsManager->setEventsManager($eventsManager);
        $this->view->setEventsManager($eventsManager);

        $eventsManager->attach('dispatch', new Dispatch());
        $eventsManager->attach('modelsManager', new ModelsManager());
        $eventsManager->attach("application", new EventApplication());
        $eventsManager->attach("view", new View());
        return $this;
    }
}